cmake_minimum_required(VERSION 2.6)
PROJECT(#APPNAME_LC#)

#make the list with all the source files
FILE(GLOB_RECURSE SOURCES "${CRTMPSERVER_SOURCES_ROOT}/applications/${PROJECT_NAME}/src/*.cpp" )

SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CRTMPSERVER_ROOT}/${PROJECT_NAME}")

#prepare the include directories
INCLUDE_DIRECTORIES(
	${OPENSSL_INCLUDE_PATH}
	${LUA_INCLUDE_PATH}
	${CRTMPSERVER_SOURCES_ROOT}/common/include
	${CRTMPSERVER_SOURCES_ROOT}/thelib/include
	${CRTMPSERVER_SOURCES_ROOT}/applications/${PROJECT_NAME}/include
	)

string(TOUPPER ${PROJECT_NAME} TEMP_APP_NAME)
SET_PROPERTY(GLOBAL APPEND PROPERTY ACTIVE_APPS "-DHAS_APP_${TEMP_APP_NAME}")
SET_PROPERTY(GLOBAL APPEND PROPERTY ACTIVE_APPS_LIBS "${PROJECT_NAME}")

#create the library
ADD_LIBRARY(${PROJECT_NAME} ${LIB_TYPE} ${SOURCES})
ADD_PRECOMPILED_HEADER(${PROJECT_NAME} "${CRTMPSERVER_SOURCES_ROOT}/common/include/common.h")
IF(${LIB_TYPE} MATCHES "SHARED")
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} thelib)
    INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CRTMPSERVER_ROOT}/${PROJECT_NAME})
ENDIF(${LIB_TYPE} MATCHES "SHARED")


